package com.sm.dao.impl;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.sm.dao.interfaces.UsersMapper;
import com.sm.entity.Users;
import com.sm.entity.UsersExample;

@Repository("usersMapper1")
public class UserMapperImpl implements UsersMapper {
	private static Log log = LogFactory.getLog(UserMapperImpl.class);
	private static final String namepace = "com.sm.dao.interfaces.UsersMapper";
	
	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public long countByExample(UsersExample example) {
		log.error("userMapper1 ......SqlSessionTemplate");
		return sqlSessionTemplate.selectOne(namepace+".countByExample", example);
	}

	@Override
	public int deleteByExample(UsersExample example) {
		log.error("userMapper1 ......SqlSessionTemplate");
		return sqlSessionTemplate.delete(namepace+".deleteByExample", example);
	}

	@Override
	public int deleteByPrimaryKey(Integer id) {
		log.error("userMapper1 ......SqlSessionTemplate");
		return sqlSessionTemplate.delete(namepace+".deleteByPrimaryKey", id);
	}

	@Override
	public int insert(Users record) {
		log.error("userMapper1 ......SqlSessionTemplate");
		return sqlSessionTemplate.insert(namepace+".insert", record);
	}

	@Override
	public int insertSelective(Users record) {
		log.error("userMapper1 ......SqlSessionTemplate");
		return sqlSessionTemplate.insert(namepace+".insertSelective", record);
	}

	@Override
	public List<Users> selectByExample(UsersExample example) {
		log.error("userMapper1 ......SqlSessionTemplate");
		return sqlSessionTemplate.selectList(namepace+".selectByExample", example);
	}

	@Override
	public Users selectByPrimaryKey(Integer id) {
		log.error("userMapper1 ......SqlSessionTemplate");
		return sqlSessionTemplate.selectOne(namepace+".selectByPrimaryKey", id);
	}

	@Override
	public int updateByExampleSelective(Users record, UsersExample example) {
		log.error("userMapper1 ......SqlSessionTemplate");
		return sqlSessionTemplate.update(namepace+".updateByExampleSelective",example);
	}

	@Override
	public int updateByExample(Users record, UsersExample example) {
		log.error("userMapper1 ......SqlSessionTemplate");
		return sqlSessionTemplate.update(namepace+".updateByExample", example);
	}

	@Override
	public int updateByPrimaryKeySelective(Users record) {
		log.error("userMapper1 ......SqlSessionTemplate");
		return sqlSessionTemplate.update(namepace+".updateByPrimaryKeySelective", record);
	}

	@Override
	public int updateByPrimaryKey(Users record) {
		log.error("userMapper1 ......SqlSessionTemplate");
		return sqlSessionTemplate.update(namepace+".updateByPrimaryKey", record);
	}

}
